package com.aos.erp.manager.rpc.sys;

import com.aos.erp.common.bean.ResultEntity;
import com.aos.erp.common.constant.GlobalConstant;
import com.aos.erp.common.exception.BizException;
import com.aos.erp.manager.enums.sys.UserType;
import com.aos.erp.manager.model.sys.User;
import com.aos.erp.manager.model.sys.dto.UserDto;
import com.aos.erp.manager.model.sys.vo.SchoolUserVo;
import com.aos.erp.manager.model.sys.vo.UserVo;
import com.aos.erp.manager.service.sys.UserService;
import com.aos.erp.manager.util.UserUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import java.util.Objects;

/**
 * @program: erp
 * @description: 后台用户
 * @author: tanzhiyu
 * @create: 2018-10-31 11:27
 **/
@Api(value = "傲雄后台用户", tags = {"后台用户API"})
@RestController("RPCUserController")
@RequestMapping("/service/rpcUser")
public class UserController {
    @Resource
    private UserService userService;

    @ApiOperation(value = "初始化新增驾校用户")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "用户名字", required = true, dataType = "String"),
            @ApiImplicitParam(name = "username", value = "用户账号", required = true, dataType = "String"),
            @ApiImplicitParam(name = "password", value = "登陆密码或者密码标识(比如密码md5)", dataType = "String"),
            @ApiImplicitParam(name = "depCode", value = "部门组织code", dataType = "String"),
            @ApiImplicitParam(name = "expireDatetime", value = "用户到期时间 （默认空表示长期", dataType = "date"),
            @ApiImplicitParam(name = "操作人id", value = "操作人id",  dataType = "Long"),
            @ApiImplicitParam(name = "appCode", value = "appCode",  dataType = "String")
    })
    @PostMapping("/addApply")
    public ResultEntity addApply(@RequestBody SchoolUserVo schoolUserVo) throws Exception {
        userService.addBeanSchool(schoolUserVo,schoolUserVo.getAppCode());
        return ResultEntity.success();
    }
}
